//=============================================================================
//
//   File : qtg_qpushbutton.cpp
//   Creation date : Sab 19 mar 2011 09:31:42 CET by Antonino G.Imbesi
//
//   This file is part of the QtGLauncher distribution
//   Copyright (C) 2011 Antonino G. Imbesi <grifisx at barmes dot org>
//
//   This program is FREE software. You can redistribute it and/or
//   modify it under the terms of the GNU General Public License
//   as published by the Free Software Foundation; either version 2
//   of the License, or (at your opinion) any later version.
//
//   This program is distributed in the HOPE that it will be USEFUL,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//   See the GNU General Public License for more details.
//
//   You should have received a copy of the GNU General Public License
//   along with this program. If not, write to the Free Software Foundation,
//   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
//=============================================================================

#include "qtg_qpushbutton.h"
/*
qtg_qpushbutton::qtg_qpushbutton() :
        QPushButton(0)
{
    // Setto come politica di base di non avere mai il focus per evitare un problema nella visualizzazione
    // del rettangolo di focus sui pulsanti
    setFocusPolicy(Qt::NoFocus);
    connect(this, SIGNAL(clicked()),
            this, SLOT(clickHandler()));
}

qtg_qpushbutton::qtg_qpushbutton(QWidget *parent) :
        QPushButton(parent)
{
    // Setto come politica di base di non avere mai il focus per evitare un problema nella visualizzazione
    // del rettangolo di focus sui pulsanti
    setFocusPolicy(Qt::NoFocus);
    connect(this, SIGNAL(clicked()),
            this, SLOT(clickHandler()));
}
*/
qtg_qpushbutton::qtg_qpushbutton(QWidget *parent,QString szText) :
        QPushButton(parent)
{
    // Setto come politica di base di non avere mai il focus per evitare un problema nella visualizzazione
    // del rettangolo di focus sui pulsant
    setText(szText);
    setFocusPolicy(Qt::NoFocus);
    connect(this, SIGNAL(clicked()),
            this, SLOT(clickHandler()));

}

qtg_qpushbutton::~qtg_qpushbutton()
{

}



void qtg_qpushbutton::clickHandler()
{
    // Mi serviva che il segnale clicked passasse come paramentro una stringa quindi l'ho intercettato e adattato
    if(m_szPath!="")
        emit(clicked(m_szPath));
    else
        emit(clicked(text()));
}

void qtg_qpushbutton::setFolderPath(QString path)
{
    m_szPath= path;
}
